package com.huawei.rbac.mapper;

import com.huawei.rbac.domain.Employee;
import com.huawei.rbac.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    int selectForCount(QueryObject qo);

    List<Employee> selectForList(QueryObject qo);

    // 方法多个参数需要使用@Param注解来封装(Map)
    // 保存员工和角色的关系
    void insertEmpAndRoleRelation(@Param("empId") Long empId, @Param("roleId") Long roleId);

    // 删除员工和角色的关系
    void deleteEmpAndRoleRelation(@Param("empId") Long empId, @Param("roleId") Long roleId);

    // 查询员工账号和密码
    Employee selectEmployeeByUsernamePassword(@Param("name")String name,@Param("password")String password);
}